package com.aramco.fion.model.presentation
{
	import com.aramco.fion.event.LoadQueryEvent;
	import com.aramco.fion.vo.FionVo;
	
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import mx.collections.ArrayCollection;

	public class TestDashboardPresentationModel
	{
		public function TestDashboardPresentationModel()
		{
		}
		
		
		[Dispatcher]
		public var dispatcher : IEventDispatcher;
		
		[Bindable]
		public var dataprovider:ArrayCollection;
		
		private var _appMeta:FionVo;
		
		
		[Bindable]
		[Inject("queryModel.appMeta", bind="true")]
		public function get appMeta():FionVo
		{
			return _appMeta;
		}
		
		public function set appMeta(value:FionVo):void
		{
			if(value != null)
			{
				_appMeta = value;
				dataprovider = new ArrayCollection(value.dashboards);
			}
			
		}
		
		public function loadDashboard():void
		{
			var loadDashboardEvent:LoadQueryEvent = new LoadQueryEvent(LoadQueryEvent.LOAD_XML_APP_EVENT);
			dispatcher.dispatchEvent(loadDashboardEvent);
			
		}
	}
}